package com.college.facade.impl;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;

import com.college.domain.CourseDetails;
import com.college.facade.CourseDetailsFacade;
import com.college.populator.impl.CourseDetailsPopulatorImpl;
import com.college.service.impl.CourseDetailsServiceImpl;

public class CourseDetailsFacadeImpl implements CourseDetailsFacade{
	
	@Autowired
	private CourseDetailsServiceImpl courseDetailsService;
	@Autowired
	private CourseDetailsPopulatorImpl courseDetailsPopulator;

	@Override
	public boolean addCourse(HttpServletRequest request,CourseDetails courseDetails) {
		courseDetailsPopulator.courseDetailsPopulation(request, courseDetails);
		return courseDetailsService.addCourseDetails(courseDetails);
	}

	@Override
	public CourseDetails getCourseDetailsForCourseCode(String courseCode) {

		return courseDetailsService.getCourseDetailsForCourseCode(courseCode);
	}

	@Override
	public boolean updateCourse(HttpServletRequest request,CourseDetails courseDetails) {
		
		courseDetailsPopulator.courseDetailsPopulation(request, courseDetails);
		return courseDetailsService.updateCourseDetails(courseDetails);
	}

}
